
<template>
  <view class="login-container">
    <view class="login-wrapper">
      <view class="header">
        <!-- <h1>建筑饰面损伤智能诊断系统</h1> -->
		<text style="font-size: 25px;">登录</text>
      
      </view>
      
      <form class="form-group">
        <view class="input-box">
          <image class="input-icon" src="/static/用户.png" mode="aspectFit"></image>
          <input type="text" placeholder="请输入账号" v-model="User"/>
        </view>
        
        <view class="input-box">
          <image class="input-icon" src="/static/password.png" mode="aspectFit"></image>
		  <!-- <image class="input-icon-two" :src="isShow ? showPwdIcon : hidePwdIcon" mode="aspectFit"></image> -->
          <input type="text" :password = "true"  placeholder="请输入密码"  v-model="Pass"/>
        </view>
        
        <button class="code-btn" @click="login">登录</button>
        
        <view class="agreement">
          <text>注册即表示同意</text>
          <text class="link">《用户服务协议》</text>
          <text>和</text>
          <text class="link">《隐私政策》</text>
        </view>
      </form>
      
      <view class="third-party">
        <view class="divider">
          <view class="line"></view>
          <text>第三方登录</text>
          <view class="line"></view>
        </view>
        
        <view class="social-buttons">
          <button class="social-btn" @click="loadThirdPartyLogin">
            <image src="/static/白猫.png" mode="aspectFit"></image>
          </button>
          <button class="social-btn" @click="loadThirdPartyLogin">
            <image src="/static/布偶猫.png" mode="aspectFit"></image>
          </button>
          <button class="social-btn" @click="loadThirdPartyLogin">
            <image src="/static/橘猫.png" mode="aspectFit"></image>
          </button>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
// import hidePwdIcon from'/static/密码显示隐藏-02.png'
// import showPwdIcon from '/static/密码显示隐藏-01.png'
import { onMounted, ref } from 'vue'
import {API} from '@/common/ts/api'
// import { type UniHttpRequestRecord} from '@/common/ts/http */
import { apiFetch } from '@/common/ts/utils';
const User = ref('');
const Pass = ref('');
const isShow = ref(false);

function loadThirdPartyLogin(){
	uni.showToast({
		title:"暂无第三方登录",
	    icon:'none',
		duration:2000
	})
}
async function login()
{
	
	try{
		/* await uni.request({
			url:API.BASE+API.USER_LOGIN.URL,
			method:API.USER_LOGIN.Method,
			data:{
				args:{
					username: User.value,  
				    password: Pass.value   
				}
			},
			success: (res) => {
			        uni.redirectTo({
			        	url:"/pages/index/index"
			        })
					}
		}) */
		const promise =  apiFetch(API.USER_LOGIN);
		promise.then(res =>{
			console.log(res)
		})
	}
	catch(error)
	{
		console.error('登录请求失败:', error);
		uni.showToast({ title: '网络异常，请重试', icon: 'none' });
	}
}
</script>

<style lang="scss" scoped>
@import "@/common/css/login.scss";

</style>

